home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWGDIObj.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.5 KB  |  187 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGDIObj.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. #ifdef FW_BUILD_WIN
  10.  
  11. #ifndef FWGDIOBJ_H
  12. #define FWGDIOBJ_H
  13.  
  14. #ifndef SLGRDEF_H
  15. #include "SLGrDef.h"
  16. #endif
  17.  
  18. #ifndef FWGCONST_H
  19. #include "FWGConst.h"
  20. #endif
  21.  
  22. #ifndef FWPAT_H
  23. #include "FWPat.h"
  24. #endif
  25.  
  26. #ifndef PRSHATTR_H
  27. #include "PRShAttr.h"
  28. #endif
  29.  
  30. // ----- Foundation Layer -----
  31.  
  32. #ifndef   FWEXCLIB_H
  33. #include "FWExcLib.h"
  34. #endif
  35.  
  36. //========================================================================================
  37. //    class FW_CPrivWinGDIObjectHandle
  38. //========================================================================================
  39.  
  40. class FW_CPrivWinGDIObjectHandle
  41. {
  42. public:
  43.     FW_CPrivWinGDIObjectHandle()
  44.         { fObject = NULL; fIsStock = FALSE; }
  45.     FW_CPrivWinGDIObjectHandle(HGDIOBJ hObject, FW_Boolean isStock)
  46.         { fObject = hObject; fIsStock = isStock; }
  47.  
  48.     FW_Boolean operator==(const FW_CPrivWinGDIObjectHandle& other) const
  49.         { return fObject == other.fObject;}
  50.     FW_Boolean operator!=(const FW_CPrivWinGDIObjectHandle& other) const
  51.         { return fObject != other.fObject;}
  52.  
  53.     FW_Boolean operator==(HGDIOBJ GDIObject) const
  54.         { return fObject == GDIObject; }
  55.     FW_Boolean operator!=(HGDIOBJ GDIObject) const
  56.         { return fObject != GDIObject ;}
  57.  
  58.     operator HGDIOBJ() const
  59.         { return fObject; }
  60.                 
  61.     HGDIOBJ     fObject;
  62.     FW_Boolean     fIsStock;
  63.     
  64. private:
  65.     FW_CPrivWinGDIObjectHandle(const FW_CPrivWinGDIObjectHandle& other);
  66.     FW_CPrivWinGDIObjectHandle& operator=(const FW_CPrivWinGDIObjectHandle& other);
  67. };
  68.  
  69. //========================================================================================
  70. //    class FW_CPrivWinGDIObject
  71. //========================================================================================
  72.  
  73. class FW_CPrivWinGDIObject
  74. {
  75. public:
  76.     FW_DECLARE_AUTO(FW_CPrivWinGDIObject)
  77.  
  78.     FW_CPrivWinGDIObject();
  79.     virtual ~FW_CPrivWinGDIObject();
  80.     
  81.     void                SetStockID(int stockID);
  82.     
  83.     void                UnselectObject(HDC hdc);
  84.     void                SelectObject(HDC hdc);
  85.     
  86.     HGDIOBJ                GetObject(HDC hdc);
  87.     
  88.     virtual HGDIOBJ        CreateObject() = 0;
  89.  
  90. private:    
  91.     void                MakeGDIObject(FW_CPrivWinGDIObjectHandle& GDIObject);
  92.     void                DeleteGDIObject(FW_CPrivWinGDIObjectHandle& GDIObject);
  93.  
  94. protected:    
  95.     FW_CPrivWinGDIObjectHandle        fGDIObject;
  96.     
  97.     FW_Boolean            fChanged;
  98.     
  99.     int                    fStockID;
  100.     FW_Boolean            fStockObject;
  101.     
  102.     HDC                    fDC;
  103.     HGDIOBJ                fPreviousObject;
  104. };
  105.  
  106. //========================================================================================
  107. //    class FW_CPrivGDIPen
  108. //========================================================================================
  109.  
  110. class FW_CPrivGDIPen : public FW_CPrivWinGDIObject
  111. {
  112. public:
  113.     FW_CPrivGDIPen();
  114.     virtual ~FW_CPrivGDIPen();
  115.  
  116.     void                SetPenSize(int width);
  117.     void                SetPenStyle(FW_EStyleDash dashStyle);
  118.     void                SetPenColor(COLORREF color);
  119.  
  120.     virtual HGDIOBJ        CreateObject();
  121.     
  122.     int                    GetPenSize();
  123.  
  124. private:    
  125.     int                    fWidth;
  126.     FW_EStyleDash        fDashStyle;
  127.     COLORREF            fColor;
  128. };
  129.  
  130. //----------------------------------------------------------------------------------------
  131. //    FW_CPrivGDIBrush::GetPenSize
  132. //----------------------------------------------------------------------------------------
  133.  
  134. inline int FW_CPrivGDIPen::GetPenSize()
  135. {
  136.     return fWidth;
  137. }
  138.  
  139. //========================================================================================
  140. //    class FW_CPrivGDIBrush
  141. //========================================================================================
  142.  
  143. class FW_CPrivGDIBrush : public FW_CPrivWinGDIObject
  144. {
  145. public:
  146.     FW_CPrivGDIBrush();
  147.     virtual ~FW_CPrivGDIBrush();
  148.  
  149.     void                SetBrushPattern(const FW_PPrivPattern& pattern);
  150.     void                SetBrushColor(COLORREF color);
  151.  
  152.     virtual HGDIOBJ        CreateObject();
  153.  
  154.     HBRUSH                GetBrush(HDC hdc);
  155.  
  156. private:    
  157.     FW_Boolean            fSolidColorBrush;
  158.     COLORREF            fColor;
  159.     FW_PPrivPattern        fPattern;
  160. };
  161.  
  162. //========================================================================================
  163. //    class FW_CPrivGDIFont
  164. //========================================================================================
  165.  
  166. class FW_CPrivGDIFont : public FW_CPrivWinGDIObject
  167. {
  168. public:
  169.     FW_CPrivGDIFont();
  170.     virtual ~FW_CPrivGDIFont();
  171.  
  172.     void                SetFontName(const char* fontName);
  173.     void                SetFontStyle(FW_FontStyle fontStyle);
  174.     void                SetFontSize(short fontSize);
  175.  
  176.     virtual HGDIOBJ    CreateObject();
  177.     
  178. private:
  179.     char                fFontName[LF_FACESIZE];
  180.     FW_FontStyle        fFontStyle;
  181.     short                fFontSize;
  182. };
  183.  
  184. #endif
  185.  
  186. #endif
  187.